package cn.z2huo.productcenter.management.app.test;

import cn.hutool.core.util.URLUtil;
import org.springframework.web.util.UriUtils;

import java.nio.charset.StandardCharsets;

/**
 * <p>
 *
 * @author z2huo
 */
public class UrlEncodeDecode {
    public static void main(String[] args) {
        System.out.println(URLUtil.encode("+"));
        System.out.println(URLUtil.encode(" "));
        System.out.println(URLUtil.decode("+"));
        System.out.println(URLUtil.decode("%20"));
        System.out.println(URLUtil.decode("+"));
        System.out.println();

        System.out.println(UriUtils.encode("+", StandardCharsets.UTF_8));
        System.out.println(UriUtils.encode(" ", StandardCharsets.UTF_8));
        System.out.println(UriUtils.decode("+", StandardCharsets.UTF_8));
        System.out.println(UriUtils.decode("%20", StandardCharsets.UTF_8));
        System.out.println(UriUtils.decode("+", StandardCharsets.UTF_8));
    }
}
